pp108 : Configuring Multiple Appenders

Configuring Multiple Appenders

Before you begin this task:
Before making the changes in Log4jConfiguration.xml file, ensure that the content in XML is valid. The changes made in Log4jConfiguration.xml will be applied immediately.

Multiple appenders can be configured by specifying the corresponding <appender-ref> element under <category>. The following example illustrates the configuration of multiple appenders:

Adding a logging category

  1. Go to Process_Platform_install_dir/config directory and open the file Log4jConfiguration.xml.
  2. Add the following category which contains multiple appenders processNamefile and e-mail.
    <category name="com.eibus.management.AlertSystem">
        <priority value="info"/>
        <appender-ref ref="processNamefile"/>
        <appender-ref ref="e-mail"/>
    </category>
    
  3. Add the Appenders for processNamefile and e-mail
    <appender class='com.eibus.util.logger.appender.ProcessNamedDailyRollingFileAppender' name='processNamefile'>
        <param name='File' value='%N.xml' />
        <param name='DatePattern' value=".'yyyy-MM-dd" />
        <layout class='org.apache.log4j.xml.XMLLayout' />
    </appender>
    <appender class='org.apache.log4j.net.SMTPAppender' name='e-mail'>
        <param name='SMTPHost' value='ADDRESS-OF-SMTP-Host' />
        <param name='To' value='DESTINATION@EMAIL' />
        <param name='From' value='SENDER@EMAIL' />
        <layout class='org.apache.log4j.xml.XMLLayout' />
    </appender>
    
  4. Save the configuration.

Viewing log entries

  1. Perform any operation that raises the alerts. For example, restarting the Monitor, sending license report, restarting the database server and so on.
  2. Then, alerts are displayed in the Process_Platform_install_dir/Logs folder and can be received as e-mails.